package com.kunzai.threadrun;

/**
 * 后台线程：
 *  我们在代码当中创建的线程默认都是前台线程
 *  卖票那个案列：
 *      我们手动创建的线程默认都是前天线程，那么四个窗口就存在四个前台线程
 *      main方法是前台线程
 *      这里说的是如何设置后台线程（就是守护线程）
 */

public class DamonThread implements Runnable{
    /**
     * When an object implementing interface <code>Runnable</code> is used
     * to create a thread, starting the thread causes the object's
     * <code>run</code> method to be called in that separately executing
     * thread.
     * <p>
     * The general contract of the method <code>run</code> is that it may
     * take any action whatsoever.
     *
     * @see Thread#run()
     */
    @Override
    public void run() {
        while (true){
            System.out.println(
                    Thread.currentThread().getName()+"在运行"
            );
        }
    }
}
